package cn.baage.campus.exception;

import cn.baage.campus.enums.ExceptionType;
import lombok.Getter;

/**
 * @Description: 业务异常
 * @Author: 八阿哥
 * @url: baage.cn
 * @Version: 1.0
 **/
@Getter
public class BizException extends RuntimeException {

    // 异常码
    private final Integer errorCode;
    // 错误信息
    private final String errorMessage;

    public BizException(ExceptionType exceptionType) {
        super(exceptionType.getErrorMessage());
        this.errorCode = exceptionType.getErrorCode();
        this.errorMessage = exceptionType.getErrorMessage();
    }

    public BizException(Integer errorCode, String errorMessage) {
        super(errorMessage);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

}
